﻿// News Framework
// (C) Tanzim Saqib. Oct 25, 2010.
// http://TanzimSaqib.com | http://newsfx.codeplex.com

namespace TanzimSaqib.NewsFramework
{
    using System.Collections.Generic;
    using System.Collections.ObjectModel;
    using System.Globalization;
    using System.Diagnostics;

    internal static class StringExtension
    {
        [DebuggerStepThrough]
        public static string FormatWith(this string instance, params object[] args)
        {
            return string.Format(CultureInfo.CurrentUICulture, instance, args);
        }

        [DebuggerStepThrough]
        public static void CopyToObservableCollection(this List<RssItem> items, ObservableCollection<ItemViewModel> collection)
        {
            collection.Clear();

            foreach (var item in items)
            {
                collection.Add(new ItemViewModel() { LineOne = item.Title, LineTwo = item.ThumbnailURL, LineThree = item.Link });
            }
        }
    }
}
